/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package managerBeanAdmin;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.bean.SessionScoped;
import processor.ComplaintFacade;

import report.Detailreport;
import report.Summaryreport;

/**
 *
 * @author maynoigi
 */
@ManagedBean
@SessionScoped
public class DetailedReportBean implements Serializable{

    @EJB
    private ComplaintFacade complaintFacade;
    private List<Detailreport> filteredReport;
    private List<Detailreport> detailedReport;
    private Date daily;
    private Date fromWeekly;
    private Date toWeekly;
    private Date monthly;
    private String flag="All";

    public String getFlag() {
        return flag;
    }

    public void setFlag(String flag) {
        this.flag = flag;
    }

    public List<Detailreport> getFilteredReport() {
        return filteredReport;
    }

    public void setFilteredReport(List<Detailreport> filteredReport) {
        this.filteredReport = filteredReport;
    }

    public List<Detailreport> getDetailedReport() {
          if (flag.equals("All")) {
                detailedReport = complaintFacade.detailReport();
           
        } else if (flag.equals("Daily")) {
                 detailedReport = complaintFacade.detailReportDaily(daily);

        } else if (flag.equals("In Range")) {
                 detailedReport = complaintFacade.detailReportRange(fromWeekly, toWeekly);
        }

        return detailedReport;
    }

    public void setDetailedReport(List<Detailreport> detailedReport) {
        this.detailedReport = detailedReport;
    }



    public Date getDaily() {
        return daily;
    }

    public void setDaily(Date daily) {
        this.daily = daily;
    }

    public Date getFromWeekly() {
        return fromWeekly;
    }

    public void setFromWeekly(Date fromWeekly) {
        this.fromWeekly = fromWeekly;
    }

    public Date getToWeekly() {
        return toWeekly;
    }

    public void setToWeekly(Date toWeekly) {
        this.toWeekly = toWeekly;
    }

    public Date getMonthly() {
        return monthly;
    }

    public void setMonthly(Date monthly) {
        this.monthly = monthly;
    }
   public void detailReportByDaily() {
        flag = "Daily";
    }

    public void detailReportByWeekly() {
        flag = "In Range";
    }
    public DetailedReportBean() {
    }
}
